<?php virtual('/comunidadVirtual/Connections/local.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}



mysql_select_db($database_local, $local);
//$query_Recordset2 = "SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'plg_a1eajml4lf' AND TABLE_NAME = 'pligg_friends'";


$query_Recordset2 = "SELECT pligg_users.user_login, pligg_users.user_avatar_source, pligg_users.user_email, pligg_users.user_id FROM pligg_recomendados INNER JOIN pligg_users ON pligg_recomendados.recomendado = pligg_users.user_login WHERE (pligg_recomendados.recomendadop= 'admin')";


	//	echo "SELECT " . table_users . ".user_login, " . table_users . ".user_avatar_source, " . table_users . ".user_email, " . table_users . ".user_id FROM pligg_recomendados INNER JOIN " . table_users . " ON pligg_recomendados.recomendadop = " . table_users . ".user_login WHERE ((pligg_recomendados.recomendadop)= " . $current_user->user_login . ")"

//$query_Recordset2 = "SELECT p_u.user_login AS logIn, p_u.user_avatar_source AS avatar, p_u.user_email AS userMail, p_u.user_id AS userId p_u2.user_login AS logIn2, p_u2.user_avatar_source AS avatar2, p_u2.user_email AS userMail2, p_u2.user_id AS userId2 FROM pligg_friends AS p_f  INNER JOIN (pligg_users AS p_u ON (p_f.friend_to = p_u.user_id )  WHERE (p_f.friend_from = 3 )) INNER JOIN (pligg_users AS p_u2 ON (p_f.friend_from = p_u2.user_id )  WHERE (p_f.friend_to = 3));"; 


/*$query_Recordset2 = "SELECT p_u.user_login AS logIn, p_u.user_avatar_source AS avatar, p_u.user_email AS userMail, p_u.user_id AS userId

p_u2.user_login AS logIn2, p_u2.user_avatar_source AS avatar2, p_u2.user_email AS userMail2, p_u2.user_id AS userId2




 FROM pligg_friends AS p_f  LEFT JOIN pligg_users AS p_u ON (p_f.friend_to = p_u.user_id )  WHERE ((p_f.friend_from)= 3 ) 
  LEFT JOIN pligg_users AS p_u2 ON (p_f.friend_to = p_u2.user_id )  WHERE ((p_f.friend_from)= 3 ) 
 
 "; 


$query_Recordset2 = "SELECT p_u.user_login AS logIn, p_u.user_avatar_source AS avatar, p_u.user_email AS userMail, p_u.user_id AS userId FROM pligg_friends AS p_f  LEFT JOIN pligg_users AS p_u ON (p_f.friend_to = p_u.user_id )  WHERE ((p_f.friend_from)= 3 ) "; /*/



//$query_Recordset2 = "SELECT pligg_users.user_login, pligg_users.user_avatar_source, pligg_users.user_email, pligg_users.user_id FROM pligg_friends AS p_f  LEFT JOIN pligg_users AS p_u ON (pligg_friends.friend_to = pligg_users.user_id )  WHERE ((pligg_friends.friend_from)= 3 )"; 




$Recordset2 = mysql_query($query_Recordset2, $local) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);




?>
<?php do { ?>
  <table>
    <tr>
      <td><?php //echo  $row_Recordset2['user_login']." :) ";
	  echo print_r($row_Recordset2)." :) ";
	   ?></td>
    </tr>
      </table>
  <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
  
  mysql_free_result($Recordset2);
   ?>